;(function(){
    let jQuery=
    (window.jQuery=
    window.$=
    function(selector){
        // return new jQuery.fn.prototype.init(selector)
        return new jQuery.fn.init(selector)
    })
   jQuery.fn = jQuery.prototype={
        init:function(selector){
            var elements=document.querySelectorAll(selector)
            Array.prototype.push.apply(this,elements)
            // this.length=elements.length
            return this
        }, 
        jQuery:"1.0.0",
        author:"zhb",
        length:0,
        size:function(){
            return this.length
        }
    }
    // jQuery.fn.prototype.init.prototype=jQuery.fn
    jQuery.fn.init.prototype=jQuery.fn


    jQuery.extend=jQuery.fn.extend=function(){
        if(arguments.length==1){
            var o=arguments[0]
            for(var p in o){
                this[p]=o[p]
            }
        }else{
            let target=arguments[0]
            for(let i=1;i<arguments.length;i++){
                let o=arguments[i]
                for(var p in o){
                    target[p]=o[p]
                }
            }
        }
    }

    jQuery.extend(jQuery,{
        trim:function(text){
            return(text||"").replace(/^\s+|\s+$/g,"")
        },
        noConflict:function(){
            window.$=_$
            window.jQuery=_jQuery
            return jQuery
        }
    })

    jQuery.fn.extend({
        get:function(index){
            return this[index]
        },
        each:function(fn){
            for(var i=0;i<this.length;i++){
                fn(this[i],i,this[i])
            }
            return this
        }
    })

    jQuery.fn.extend({
        css:function(){
            var l=arguments.length
            if(l==1){
                return this[0].style[arguments[0]]
            }else{
                var name=arguments[0]
                var value=arguments[1]
                this.each(function(index,ele){
                    ele.style[name]=value
                })
            }
            return this
        }
    })
})()